import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;

public class KeyWordFilterParameter {
	
	KeyWordFilterParameter(){
		String xmlpath = "keywordsFilter.xml";
		SAXBuilder builder = new SAXBuilder(false);
		try {
			doc = builder.build(xmlpath);
		} catch (JDOMException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	Document doc = null;

	public List<String> getDelRegList() {	
			Element keywords = doc.getRootElement();
			host = keywords.getChildTextTrim("host");
			dbName = keywords.getChildTextTrim("dbName");
			List kwdList = keywords.getChildren("kwd");
			for (Iterator iter = kwdList.iterator(); iter.hasNext();) {
				Element kwd = (Element)iter.next();
				delRegList.add(kwd.getTextTrim());
			}	
		return delRegList;
	}

	List<String> delRegList = new ArrayList<String>();
	List<String> splitRegList = new ArrayList<String>();
	
	public List<String> getSplitRegList() {	
		Element keywords = doc.getRootElement();
		List splitList = keywords.getChildren("split");
		for (Iterator iter = splitList.iterator(); iter.hasNext();) {
			Element split = (Element)iter.next();
			splitRegList.add(split.getTextTrim());
		}	
	return splitRegList;
}

	String host = null;

	public String getHost() {
		return host;
	}

	public String getDbName() {
		return dbName;
	}

	String dbName = null;
}
